"use strict";
const lis = location.href.split("?");
// console.log(lis)
let id = (lis[1].slice(3));
// console.log(id)
Ajax(`/api/detail?id=${id}`, (data) => {
    Detailrender(data.data1);
});
const Detailrender = (data1) => {
    // console.log(data1)
    const detail = document.querySelector('.detail');
    detail.innerHTML = `
     <dl>
        <dt>
            <img src="${data1.img}" alt='' />
        </dt>
        <dd>
        <p><b>${data1.title}</b></p>
        <h3>￥${data1.num}</h3>
        <p>${data1.desc}</p>
      
        </dd>
     </dl>
     <span>
     <button class="rem">返回上一页</button>
     <button class="add">点击购买</button>
     </span>
     `;
    Button();
};
const Button = () => {
    const rem = document.querySelector('.rem');
    rem === null || rem === void 0 ? void 0 : rem.addEventListener('click', e => {
        location.href = '/index.html';
    });
    const add = document.querySelector('.add');
    add === null || add === void 0 ? void 0 : add.addEventListener('click', e => {
        location.href = '/num.html';
    });
};
